package com.zzw.hj92;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Project: hw_java
 * @Description: 在字符串中找出连续最长的数字串
 * @Author: zzw
 */

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String s = in.nextLine();
            List<String> list = new ArrayList<>();
            int max = 0;
            // 动态规划
            int[] dp = new int[s.length() + 1];
            for (int i = 1; i <= s.length(); i++) {
                if (Character.isDigit(s.charAt(i - 1))) {
                    dp[i] = dp[i - 1] + 1;
                    if (dp[i] == max) {
                        list.add(s.substring(i - max, i));
                    } else if (dp[i] > max) {
                        max = dp[i];
                        list.clear();
                        //System.out.println(s.substring(i - max, i));
                        list.add(s.substring(i - max, i));
                    }
                }
            }
            list.forEach(System.out::print);
            System.out.println("," + max);
        }
    }
}